<template>
  <div>
    <el-select v-model="inputData"  @change="change" :placeholder="placeholder" :size="size"  :style="{width: width}" clearable>
      <el-option v-for="(item,i) in dictData" :key="i" :label="item.label" :value="item.value"></el-option>
    </el-select>
  </div>
</template>
<script>
  export default {
    name:'SearchTool',
    props: {
      size: {
        type: String,
        default: 'small'
      },
      placeholder: {
        type: String,
        default: '请选择'
      },
      width:{
        type: String,
        default: '100%'
      },
      value:{

      },
      dictData:{}
    },
    data(){
      return {
        inputData: '',
      }
    },
    watch:{
      value(newVal,oldVal){
        this.inputData = newVal;
      }
    },
    methods: {
      // 提交及改变
      change(){
        this.$emit('input',this.inputData)
        this.$emit('change',{
          value:this.inputData
        })
      },
    }

  };
</script>


